-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First specialization #123
First specialization #123
Conversation
lib.rs
Outdated
|
||
#[cfg(feature = "specialization")] | ||
#[inline] | ||
default fn from(slice: &'a [A::Item]) -> SmallVec<A> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't that mean that one can specialise the implementation from outside the crate? Shouldn't we be specialising an internal trait used by this impl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add an internal SpecFrom trait then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I added a new `specialization` feature that will specialize `From<&[_: Copy]>` to use `from_slice`, which offers a nice performance boost. Alas, I could not get any measurable perf improvement on `insert_many` or `extend`, so I'll leave them out for now.
This should now be ready for merging. |
@bors-servo r+ |
📌 Commit 49c43d0 has been approved by |
First specialization I added a new `specialization` feature that will specialize `From<&[_: Copy]>` to use `from_slice`, which offers a nice performance boost. Alas, I could not get any measurable perf improvement on `insert_many` or `extend` yet, so I'll leave them out for now. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/123) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
Version 0.6.6 Changes in this release: * Fix possible over-allocation in `from_slice` (#122) * Optional nightly-only `specialization` feature for `from_slice` optimization (#123) * New `from_raw_parts` constructor (#130) * Documentation and testing improvements (#125, #129) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/131) <!-- Reviewable:end -->
I added a new
specialization
feature that will specializeFrom<&[_: Copy]>
to usefrom_slice
, which offers a nice performance boost.Alas, I could not get any measurable perf improvement on
insert_many
orextend
yet, so I'll leave them out for now.This change is